import dingtalk from 'weex-dingtalk';
// 打开连接
export function openUrl (url) {
  dingtalk.ready(function(){
    dingtalk.apis.biz.util.openLink({
      url :url
    });
  });
}

// 设置右侧按钮
export function setRight(config,cb){
  const { control } = config;
  dingtalk.ready(function(){
    dingtalk.apis.biz.navigation.setRight(config);
    if (control){
      dingtalk.on('navRightButton',cb);
    }
  });
}
// 设置导航题目
export function setTitle(config,cb){
  const { control } = config;
   dingtalk.ready(function(){
    const dd = dingtalk.apis;
    // 设置导航
    dd.biz.navigation.setTitle(config);
  });
}


export let dingUser = {
  companyId:'dingc4cffb655c00d67f35c2f4657eb6378f',
  userId:'E0B59F6C-DE32-4F4D-B7D4-AE7E4D5CFE80',
  userName:'王永晨',
  isAdmin:1,
  showSpecialTraining:true
}
// 数据请求接口路径
// let protocol = window.location.protocol;
// let host     = window.location.host;
// let hostUrl  = protocol+"//"+host+'/Api/v1.0/index.php/';

export let jump = 'http://saas.eduto.com/DingFront/Html'; //测试环境
// export let jump = 'http://saas.eduto.com/DingFront/DingFront/Html'; //正式环境

// 数据请求接口
export let hostUrl  = 'http://saas.eduto.com/Api/v1.0/index.php/';  //测试环境
// export let hostUrl  = 'https://saas.hz.taeapp.com/Api/v1.0/index.php/';  //正式环境

// 图片访问路径
export let imgSrc = 'http://saas.eduto.com/DingFront';  //测试环境
// export let imgSrc = 'https://saas.hz.taeapp.com/DingFront';  //正式环境